package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.manger.dto.ActivityFindDto;
import com.zhentao.model.common.manger.pojo.Activity;
import com.zhentao.service.ActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 王越潇
 * @version 1.0
 * @Date 2024/10/2 22:31
 * @Type
 */
@RestController
@RequestMapping("ma/activity")
@Api(tags = "活动管理")
public class ActiveController {
    @Resource
    private ActivityService activityService;
    @PostMapping("findAll")
    @ApiOperation("活动列表")
    public ResponseResult findAll(@RequestBody ActivityFindDto dto){
        return activityService.findAll(dto);
    }
    @PostMapping("addActive")
    @ApiOperation("添加活动")
    public ResponseResult insert(@RequestBody Activity activity) throws Exception {
        return activityService.add(activity);
    }
    @PostMapping("updateActive")
    @ApiOperation("修改活动")
    public ResponseResult updateActive(@RequestBody Activity activity){
        return activityService.updateActive(activity);
    }
    @GetMapping("/delete/{id}")
    @ApiOperation("删除活动")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return activityService.delete(id);
    }
}
